//
//  IManager+RCModuleOrderListRequest.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-27.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+RCModuleOrderListRequest.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "GloableEngineService.h"
#import "RCServerListDataModel.h"
#import "RCServerCommentListDataModel.h"
#import "RCImpressiveListDataModel.h"
#import "RCServerActivityListDataModel.h"
#import "RCAttendPersonsListDataModel.h"
#import "RCMessageListDataModel.h"
#import "RCMessageNotifyListDataModel.h"
#import "RCMessageReplyListDataModel.h"

@implementation IManager (RCModuleOrderListRequest)


-(int64_t)requestListData:(RCListType)reqType
               withStatus:(RCListReviewStatus)status
                withUniID:(NSString *)uniqueID
                   withPn:(NSInteger)pn
                   withRn:(NSInteger)rn
             withDelegate:(id<IManagerDelegate>)delegate
{
    NSString *shopBduss = [[GloableEngineService sharedInstance] shopBduss];
    NSString *shopID = [[GloableEngineService sharedInstance] shopID];
    
    if ( shopBduss == nil && reqType != RCListType_MessageManage)
    {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = nil;
    Class parseClass = nil;
//    NSDictionary *userInfo  = nil;
    if (reqType == RCListType_Order) {
        urlSuffix = [NSString stringWithFormat:kRCOrderListManagerPrefix,shopBduss,shopID,status,pn,rn];
        parseClass = [RCServerOrderManageListDataModel class];
        if (status == RCListReviewStatus_UnderReview) {

        }else if (status == RCListReviewStatus_ReviewSuccess){


        }else if (status == RCListReviewStatus_ReviewFailed){

        }
    }else if (reqType == RCListType_CommentManage){
        urlSuffix = [NSString stringWithFormat:kRCCommentListManagerPrefix,shopBduss,shopID,status,pn,rn];
        parseClass = [RCServerCommentListDataModel class];
        if (status == RCListReviewStatus_UnderReview) {

        }else if (status == RCListReviewStatus_ReviewSuccess){

            
        }else if (status == RCListReviewStatus_ReviewFailed){

        }
    }else if (reqType == RCListType_ImpressiveManage){
        urlSuffix = [NSString stringWithFormat:kRCImpressiveListManagerPrefix,shopBduss,shopID,status,pn,rn];
        parseClass = [RCImpressiveListDataModel class];
        if (status == RCListReviewStatus_UnderReview) {

        }else if (status == RCListReviewStatus_ReviewSuccess){

            
        }else if (status == RCListReviewStatus_ReviewFailed){

        }
    }else if (reqType == RCListType_ActivityManage){
        urlSuffix = [NSString stringWithFormat:kRCActivityListManagerPrefix,shopBduss,shopID,status,pn,rn];
        parseClass = [RCServerActivityListDataModel class];
        if (status == RCListReviewStatus_UnderReview) {

        }else if (status == RCListReviewStatus_ReviewSuccess){

            
        }
    }else if (reqType == RCListType_DetailActivityManage) {
        urlSuffix = [NSString stringWithFormat:kRCDetailAttendListManagerPrefix,shopBduss,uniqueID,status,pn,rn];
        parseClass = [RCAttendPersonsListDataModel class];
        if (status == RCListReviewStatus_UnderReview) {

        }else if (status == RCListReviewStatus_ReviewSuccess){

        }else if (status == RCListReviewStatus_ReviewFailed){

        }
    }else if (reqType == RCListType_MessageManage) {
      
        
       
        
        if (status == RCListReviewStatus_UnderReview) {
            
            parseClass = [RCMessageNotifyListDataModel class];
            NSString *bduss = [[GloableEngineService sharedInstance] bduss];
            urlSuffix = [NSString stringWithFormat:kRCMyNotifyPrefix,bduss,pn,rn];
        }else if (status == RCListReviewStatus_UnderReview){
            
            parseClass = [RCMessageListDataModel class];
            NSString *bduss = [[GloableEngineService sharedInstance] bduss];
            urlSuffix = [NSString stringWithFormat:kRCMyMailListPrefix,bduss,pn,rn];
        }else if (status == RCListReviewStatus_UnderReview){
            
            parseClass = [RCMessageReplyListDataModel class];
            NSString *bduss = [[GloableEngineService sharedInstance] bduss];
            urlSuffix = [NSString stringWithFormat:kRCMyReplyPrefix,bduss,pn,rn];
        }
    }
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:parseClass
                                                     withDataDelegate:delegate];
}
@end
